

export default {

    // 获取大区或省
    reqDistrictsAreas (data = '') { return this.httpRequest(this.data.api$.REQ_DISTRICT_AREAS, { Data: data.Code || 0 }) },

    //获取省市区
    reqDistricts (data = '') { return this.httpRequest(this.data.api$.REQ_DISTRICTS, { Data: data.Code || 0 }) },

    cascadeFromHandle (event) {
        console.log(event);
        let { result } = this.inputParams(event);
        let { formData } = this.data;
        let arrTarget = [];
        for (let key in formData) {
            if (formData[key].sourceData) {
                arrTarget.push(formData[key]);
            }
        }
        arrTarget.forEach((item) => {
            let { index } = item.sourceData;
            this.inputHandle({ detail: { item, value: result[index] } });
        });
    },

    cascadeFilterHandle (event) {
        console.log(event);
        let { result } = this.inputParams(event);
        let { objFilter, objHiddenFilter } = this.data;
        let arrTarget = [];
        for (let key in objFilter) {
            if (objFilter[key].sourceData) {
                arrTarget.push(objFilter[key]);
            }
        }
        for (let key in objHiddenFilter) {
            if (objHiddenFilter[key].sourceData) {
                arrTarget.push(objHiddenFilter[key]);
            }
        }
        arrTarget.forEach((item) => {
            let { index } = item.sourceData;
            this.inputHandle({ detail: { item, value: result[index] } });
        });
    },
}
